function add(){
   var tal = 0;
   for (let i =0; i< arguments.length; i++){
        tal +=arguments[i]
   }
   return tal;
}

console.log(add(1,2,3,4,5))

function sum(...params){
    var tal = 0;
    console.log('params==>',params)  //params==> [ 1, 2, 3, 4, 5 ]
    params.forEach(element => {
        tal += element;
    });
    return tal;
}
console.log(sum(1,2,3,4,5))
